Skip to main content

22.03.01 - Team Coding

Implementation

How do teams do Software engineering

Social Dev Perspectives

You are not working alone

The Developer

  • Deiver the code to the teap for their approval and use
  • Prove that the code meets all the specs

The Dev Manager

  • Want one solid piece of software
  • Make sure everyone is talking to each other and helping one another
  • Prove that the whole system is finished

Integration Team

  • Special team of 4, bring it all together
  • Have to integrate the classes, and build the main system
  • Large job, few of you on single task.
    • Have to coordinate between yourselves
    • Comprehend other peoples code
    • Send code back to people if its wrong

Setting the right scene

  1. If you are in charge of some code, not a one-time task
  2. Unlikely that your the only one who has to read and understand your code
  3. Might have to fix other peoples code
  4. Need some sort of coordination between people
  5. Documenting code is a team effort too
  6. "Finishing" is a matter of other peoples judgements
  7. "Correctness" is a matter of other peoples judgement
  8. "It does everything the spec i received said it should" is probably not good enough

Coding conventions

Aims - Making code easier for everyone to understand and sets quality standards Method - Name variables like this, comments like this etc

Good practices for Code

Functions should do one thing. They should do it well. They should do it only

Strategies for Approaching Code

  • Tend to be for setting an approach that breeds code quality
  • Lots of different Higher Level team strategies
    • Model Driven Development
    • Feature Driven Development
  • Two Very popular strategies
    • Test Driven Development
    • Comment Driven Development

Test-Driven Development

Write automatic tests it must pass, then write your code. Finish coding when all the tests pass.

Comment-Driven Development

Strategy: Write the comments first Benefits: Have to properly comment the code anyway, you can design your code before building it Can do this with the entire codebase, one person can plan the code.

Avoid: Asshole-Driven Development

Coding - alongside other people

Bug Reporting/Fixing

  • Projects need a mechanism for coders telling other coders about a problem in their code.
    • Keeping track of things that need fixing
    • Having traceable-documentation of testing
  • Discovering bugs in code is a multi-coder challenge

Would need to try and reproduce the bug, so need to give them enough information.

Bug Trackers

Many companies use a bug tracker, which are very useful for any project. Can help detect the judge the defect

Debugging

Also a social issue, separated from testing

The process of locating problems with the code and changing the program to fix these problems

  • Important skill for a professional coder
  • Bugs can be hard to find, but there are strategies for finding them
  • Debugging is not testing!

Can make debugging easy by creating a script which tests.

Harder (Social) Debugging

Code runs fine just gives you the wrong answer, quite common when working with other peoples code. This is difficult as don't know where the bug is or what is causing it, as its a logic error

IDE

IDEs can help by using breakpoints, and look at variables values at certain points within the program. Some IDEs can also do trace tables

Can also use the sexy print statements to see variable values. Very useful for logic errors

Strategy Level

Strategies help find where to put print outs and breakouts, various ways of tracking which area went wrong:

  • Binary Search
  • Code changes, temporary comment out sections of code
  • Hypothesis Testing
  • Walk away and sleep on it

Should fix the bug not the symptom

Explanatory Level

Rubber Duck Debugging - Talk to a duck about your problem. Go line by line with the duck and it will fix your issues by you realising your issues. Sometimes you don't see a problem, but when you say it out lout you realise

Fagan Inspections

Best way could be to print code and do a group code inspection. Explain the code to one another

Paired Coding & Reviews

In team-strategy and code-strategy

  • One person things/checks while other person codes
  • Take turns to write functions and change pairs for different tasks

This separates problem solving and coding. Has been shown not to take significantly longer than two people coding